package com.ruoyi.drawing.test;

import lombok.extern.slf4j.Slf4j;

/**
 * @author ZhangYu
 * @date 2024/10/18 17:38
 */
@Slf4j
public class TwoNumberAdd {

    public static void main(String[] args) {
        log.info("----------------------------------------------------------------------------------{}", twoNumberAdd());
    }

    private static int[] twoNumberAdd() {
        int[] nums = {3, 2, 4};
        int target = 6;
        int[] result = new int[2];
        for (int i = 0; i < nums.length; i++) {
            for (int j = i; j < nums.length; j++) {
                if (i != j) {
                    if ((nums[i] + nums[j]) == target) {
                        result[0] = i;
                        result[1] = j;
                        return result;
                    }
                }
            }
        }
        return result;
    }

}
